package cn.itsource.zcn.org.service.impl;

import cn.itsource.zcn.org.domain.Systemdictionarytype;
import cn.itsource.zcn.org.mapper.SystemdictionarytypeMapper;
import cn.itsource.zcn.org.query.SystemdictionarytypeQuery;
import cn.itsource.zcn.org.service.ISystemdictionarytypeService;
import cn.itsource.zcn.utils.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;

/**
 * (Systemdictionarytype)表服务实现类
 *
 * @author makejava
 * @since 2021-08-14 09:11:42
 */
@Service
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class SystemdictionarytypeServiceImpl implements ISystemdictionarytypeService {
    @Autowired
    private SystemdictionarytypeMapper tSystemdictionarytypeMapper;


    /**
     * 新增数据
     *
     * @param tSystemdictionarytype 实例对象
     */
    @Override
    @Transactional
    public void save(Systemdictionarytype tSystemdictionarytype) {
        tSystemdictionarytypeMapper.save(tSystemdictionarytype);
    }

    /**
     * 修改数据
     *
     * @param tSystemdictionarytype 实例对象
     */
    @Override
    @Transactional
    public void update(Systemdictionarytype tSystemdictionarytype) {
        tSystemdictionarytypeMapper.update(tSystemdictionarytype);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     */
    @Override
    @Transactional
    public void delete(Long id) {
        tSystemdictionarytypeMapper.delete(id);
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Systemdictionarytype queryById(Long id) {
        return tSystemdictionarytypeMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @return 对象列表
     */
    @Override
    public List<Systemdictionarytype> queryAll() {
        return tSystemdictionarytypeMapper.queryAll();
    }
    /**
     * 分页+高级查询
     * @return
     */
    @Override
    public QueryResult<Systemdictionarytype> queryPage(SystemdictionarytypeQuery systemdictionarytypeQuery) {
        Integer count = tSystemdictionarytypeMapper.count(systemdictionarytypeQuery);
        if(count == 0){
            return new QueryResult<>();
        }
        List<Systemdictionarytype> list = tSystemdictionarytypeMapper.pageQuery(systemdictionarytypeQuery);
        return new QueryResult<Systemdictionarytype>(list,count);
    }

    /**
     * 批量删除
     * @param ids
     */
    @Override
    public void deleteBatch(List<Integer> ids) {
        tSystemdictionarytypeMapper.deleteBatch(ids);
    }


}
